package com.xxx.coll;

import java.util.ArrayList;
import java.util.List;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/20  14:30
 * @Copyright
 */
public class ListDome {
    public static void main(String[] args) {
        //add();

        //remove();

        //sets();

        List list = new ArrayList();
        list.add("a");
        list.add("b");
        list.add("c");//[a,b,c]
        list.add("a");
        System.out.println("list = " + list);

    }

    private static void sets() {
        List list = new ArrayList();
        list.add("a");
        list.add("b");
        list.add("c");//[a,b,c]
        list.add(1,"d");
        System.out.println("list = " + list);
        System.out.println(list.set(1,"f"));
        System.out.println(  list.indexOf("b"));
        System.out.println( list.lastIndexOf("c"));
    }

    private static void remove() {
        List list = new ArrayList();
        list.add("a");
        list.add("b");
        list.add("c");//[a,b,c]
        list.add(1,"d");
        list.remove(1);
        System.out.println("list = " + list);
    }

    private static void add() {
        List list = new ArrayList();
        list.add("a");
        list.add("b");
        list.add("c");//[a,b,c]
        list.add(1,"d");
        System.out.println("list = " + list);
    }
}
